﻿status = -1;
var itemList = Array(
1004808,
1053063,
1082695,
1152196,
1102940,
1073158,//战士结束
1004809,
1053064,
1082696,
1152197,
1102941,
1073159,//法师结束
1004811,
1053066,
1082698,
1152199,
1102943,
1073161,//飞侠结束
1004810,
1053065,
1082697,
1152198,
1102942,
1073160,//弓箭结束
1004812,
1053067,
1082699,
1152200,
1102944,
1073162//海盗结束
	);

function start() {
	action(1, 0, 0);
}

function action(mode, type, selection) {
	if (mode == 1) {
		status++;
	} else {
		if (mode == 0 && status == 0) {
			im.dispose();
			return;
		}
		status--;
	}
	if (status == 0) {
		var text = "";
		for (var i = 0; i < itemList.length; i++) {
			text += "#L" + i + "##v" + itemList[i] + "##z" + itemList[i] + "##l\r\n";
		}
		im.sendSimple("您可以任意选择一件以下物品请看清楚再选择选错概不负责：\r\n#r" + text);
	} else if (status == 1) {
		var item;
		var itemid = itemList[selection];
		var itemnum = Math.floor(Math.random() * 1 + 1);
		item = im.gainGachaponItem(itemid, itemnum, "神秘之影防具箱", 3);
		if (item != -1) {
			im.gainItem(2436245, -1);
			im.sendOk("恭喜您，获得了" + itemnum + "个#b#z" + itemid + "#");
		} else {
			im.sendOk("请你确认在背包的装备，消耗，其他窗口中是否有一格以上的空间。");
		}
		im.safeDispose();
	}
}
